package com.example.test003.controller;

import com.example.test003.domain.ResponseResult;
import com.example.test003.domain.entity.SysUser;
import com.example.test003.service.UserLoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;

@RestController
public class UserLoginController {
    @Autowired
    private UserLoginService userLoginService;

    @PostMapping("/UserLogin")
    public ResponseResult login(@RequestBody SysUser user) {
        return userLoginService.login(user);
    }

    @GetMapping("/verifyCode")
    public ResponseResult verifyCode() throws IOException {
        return userLoginService.verifyCode();
    }

    @PostMapping("/UserLogout")
    public ResponseResult logout() {
        return userLoginService.logout();
    }
}
